<%@page import="bean.ScoreVo"%>
<%@page import="bean.ScoreDTO"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel='stylesheet' href='./css/score.css'/>
<script src='./js/score.js'></script>
</head>
<body>
<form name='hiddenfrm' method='post'>
	<input type='hidden' name='nowpage'>
	<input type='hidden' name='find'>
	<input type='hidden' name='rno'>
</form>

<jsp:useBean id="sv" class="bean.ScoreVo" scope="page"></jsp:useBean>
<jsp:setProperty property="*" name="sv"/>

<%
ScoreDTO dto = new ScoreDTO();
dto.setSv(sv);
ArrayList<ScoreVo> al = dto.select();
%>


<h1>ScoreList</h1>
<div id='score_list_find'>
	<form name='score_list_frm' method='post' action='index.jsp?inc=./score/list.jsp'>
		<input type='text' name='find' value='<%=sv.getFind() %>'>
		<input type='submit' value='검색'>
	</form>
</div>

<div id='score_list_title'>
	<div class='score_list_rno'>No</div>
	<div class='score_list_grade'>학년</div>
	<div class='score_list_point'>점수</div>
	<div class='score_list_scode'>학교</div>
	<div class='score_list_mid'>아이디</div>
	<div class='score_list_examdate'>시험일</div>
	<div class='score_list_exam'>과목</div>
	<div class='score_list_rank'>등수</div>
</div>
<% for(int a=0 ; a<((al.size()>10)? 10:al.size()) ; a++)
{
	ScoreVo v = al.get(a);
%>
<div class='score_list_items'>
	<div class='score_list_rno'><%=v.getRno() %></div>
	<div class='score_list_grade'><%=v.getGrade() %></div>
	<div class='score_list_point'><%=v.getPoint() %></div>
	<div class='score_list_scode'><%=v.getScode() %></div>
	<div class='score_list_mid'>
		<a href='#' onclick='goView(<%=dto.getNowpage()%>,<%=v.getRno()%>)'>
			<%=v.getMid() %>
		</a>
	</div>
	<div class='score_list_examdate'><%=v.getExamdate() %></div>
	<div class='score_list_exam'><%=v.getExam() %></div>
	<div class='score_list_rank'><%=v.getRank() %></div>
</div>
<%
}
%>
<center>
<div id='list page'>
<a href='#' onclick='goPage(1)'>맨처음</a>
<%if(dto.getNowblock()<=1)
{	
%>
이전
<%}
else
{
%>
<a href='#' onclick='goPage(<%=dto.getStartpage()-1%>)'>이전</a>
<%} %>
[
<%
int i=dto.getStartpage();
for( ; i<=dto.getEndpage() ; i++)
{
	if(dto.getNowpage()==i)
	{
%>
<a><%=i%></a>
<%
}
	else
	{ %>
<a href='#' onclick='goPage(<%=i%>)'><%=i%></a>
<%
}
}
%>
]
<%if((dto.getNowblock()*dto.getBlocksize())>=dto.getTotpage())
{	
%>
다음
<%}
else
{
%>
<a href='#' onclick='goPage(<%=i%>)'>다음</a>
<%} %>
<a href='#' onclick='goPage(<%=dto.getTotpage()%>)'>마지막</a>
</div>
</center>
<br/>
<input type='button' value='성적추가' id='btninput'/>
<input type='button' value='보기' id='btnview'/>
<script>listInit();</script>
</body>
</html>